namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0010 : DbMigration
    {
        public override void Up()
        {
            RenameTable(name: "dbo.hrm_mas_gender", newName: "mas_genders");
            RenameTable(name: "dbo.hrm_mas_religion", newName: "mas_religions");
            RenameTable(name: "dbo.hrm_mas_nationality", newName: "mas_nationalities");
            RenameTable(name: "dbo.hrm_mas_employee_type", newName: "hrm_ps_employee_types");
            RenameTable(name: "dbo.hrm_mas_marital_status", newName: "mas_marital_statuses");
            DropForeignKey("dbo.hrm_ps_employees", "emp_status_seq", "dbo.hrm_mas_employee_status");
            DropForeignKey("dbo.HrmTmpEmployee", "EmpStatusId", "dbo.hrm_mas_employee_status");
            DropIndex("dbo.hrm_ps_employees", new[] { "emp_status_seq" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "EmpStatusId" });
            AddForeignKey("dbo.hrm_ps_employees", "emp_status_seq", "dbo.hrm_ps_employee_statuses", "emp_status_seq");
            AddForeignKey("dbo.HrmTmpEmployee", "EmpStatusId", "dbo.hrm_ps_employee_statuses", "emp_status_seq");
            CreateIndex("dbo.hrm_ps_employees", "emp_status_seq");
            CreateIndex("dbo.HrmTmpEmployee", "EmpStatusId");
            DropTable("dbo.hrm_mas_employee_status");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.hrm_mas_employee_status",
                c => new
                    {
                        emp_status_seq = c.Int(nullable: false, identity: true),
                        emp_status_code = c.String(),
                        emp_status_name = c.String(),
                        active = c.Boolean(nullable: false),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.emp_status_seq);
            
            DropIndex("dbo.HrmTmpEmployee", new[] { "EmpStatusId" });
            DropIndex("dbo.hrm_ps_employees", new[] { "emp_status_seq" });
            DropForeignKey("dbo.HrmTmpEmployee", "EmpStatusId", "dbo.hrm_ps_employee_statuses");
            DropForeignKey("dbo.hrm_ps_employees", "emp_status_seq", "dbo.hrm_ps_employee_statuses");
            CreateIndex("dbo.HrmTmpEmployee", "EmpStatusId");
            CreateIndex("dbo.hrm_ps_employees", "emp_status_seq");
            AddForeignKey("dbo.HrmTmpEmployee", "EmpStatusId", "dbo.hrm_mas_employee_status", "emp_status_seq");
            AddForeignKey("dbo.hrm_ps_employees", "emp_status_seq", "dbo.hrm_mas_employee_status", "emp_status_seq");
            RenameTable(name: "dbo.mas_marital_statuses", newName: "hrm_mas_marital_status");
            RenameTable(name: "dbo.hrm_ps_employee_types", newName: "hrm_mas_employee_type");
            RenameTable(name: "dbo.mas_nationalities", newName: "hrm_mas_nationality");
            RenameTable(name: "dbo.mas_religions", newName: "hrm_mas_religion");
            RenameTable(name: "dbo.mas_genders", newName: "hrm_mas_gender");
        }
    }
}
